﻿@inject NotificationService NotificationService
<div class="container-fluid splitbutton-demo">
    <div class="row mb-4">
        <div class="col">
            <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H3">Disabled SplitButton</RadzenText>
            <RadzenSplitButton Disabled="true" Click=@(args => OnClick(args, "Disabled SplitButton")) Text="SplitButton">
                <ChildContent>
                    <RadzenSplitButtonItem Text="Item1" Value="1" />
                    <RadzenSplitButtonItem Text="Item2" Value="2" />
                </ChildContent>
            </RadzenSplitButton>

            <RadzenSplitButton Click=@(args => OnClick(args, "Disabled SplitButton item")) Text="SplitButton Item Disabled">
                <ChildContent>
                    <RadzenSplitButtonItem Text="Item1" Value="1" />
                    <RadzenSplitButtonItem Text="Disabled Item2" Value="2" Disabled=true />
                </ChildContent>
            </RadzenSplitButton>

        </div>
    </div>
</div>

@code {
    void OnClick(RadzenSplitButtonItem item, string buttonName)
    {
        if (item != null)
        {
            NotificationService.Notify(new NotificationMessage { Severity = NotificationSeverity.Info, Summary = "SplitButton Item Clicked", Detail = $"{buttonName}, item with value {item.Value} clicked" });
        }
        else
        {
            NotificationService.Notify(new NotificationMessage { Severity = NotificationSeverity.Info, Summary = "SplitButton Clicked", Detail = $"{buttonName} clicked" });
        }
    }
}
